<template>
  <ex-dialog
    width="600px"
    class="ex-diolog"
    title="提现审核"
    :visible="visible"
    @closeDialog="handleClose"
    center
  >
    <div class="refuseMain">
      <el-form :model="form" :rules="rules" ref="ruleForm">
        <div class="list">
          <el-form-item label="打款时间：">
            <el-date-picker
              v-model="form.remitDate"
              type="date"
              placeholder="选择日期"
              value-format="yyyy-MM-dd"
            >
            </el-date-picker>
          </el-form-item>
          <el-form-item label="打款金额：" prop="remitMoney">
            <el-input v-model="form.remitMoney" placeholder="请输入打款金额：">
            </el-input>
          </el-form-item>
          <el-form-item label="银行交易单号：" prop="serialNo">
            <el-input v-model="form.serialNo" placeholder="请输入银行交易单号">
            </el-input>
          </el-form-item>
        </div>
      </el-form>
      <div style="height: 120px"></div>
      <div class="buttom">
        <el-button size="medium" @click="handleClose">返回</el-button>
        <el-button size="medium" type="primary" @click="submitForm('ruleForm')"
          >确认</el-button
        >
      </div>
    </div>
  </ex-dialog>
</template>
<script>
// components
import { manualDetail, manualAgree } from "@/api/moneyManagement";
import Loading from "@/components/Loading/index";
export default {
  components: {
    Loading,
  },
  props: {
    visible: Boolean,
    id: String,
  },
  data() {
    return {
      loading: false,
      data: {},
      remark: "",
      textarea: "",
      remark: "今日提现太频繁，请明日重试！",
      form: {
        serialNo: "",
        remitMoney: "",
        remitDate: "",
      },
      rules: {
        serialNo: [
          { required: true, message: "请输入银行交易单号", trigger: "blur" },
        ],
        remitMoney: [
          { required: true, message: "请输入打款金额", trigger: "blur" },
        ],
        remitDate: [
          { required: true, message: "请设置打款日期", trigger: "blur" },
        ],
      },
    };
  },
  // computed: {
  //   industryTypeText() {
  //     return this.applyDetail.type
  //       ? this.$getStatusText('industry_type', this.applyDetail.type)
  //       : ''
  //   }
  // },
  created() {},
  methods: {
    handleClose() {
      this.$emit("update:visible", false);
    },

    handleSuccess(msg) {
      this.$message({
        message: msg,
        type: "success",
        duration: 1500,
        onClose: () => {
          this.handleClose();
          this.$emit("success");
        },
      });
    },
    submitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          const params = {
            id: this.id,
            serialNo: this.form.serialNo,
            remitMoney: this.form.remitMoney,
            remitDate: this.form.remitDate,
          };
          manualAgree(params)
            .then((res) => {
              const {} = res.result;
              this.$message({
                message: "处理成功",
                type: "success",
                duration: 1500,
              });
              setTimeout(() => {
                this.$emit("success");
                this.$emit("update:visible", false);
              }, 800);
            })
            .finally(() => {
              this.loading = false;
            });
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
  },
};
</script>
<style lang="scss" scoped>
.buttom {
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 150px;
  margin-top: 30px;
}
.txt {
  font-size: 15px;
  margin-bottom: 20px;
}
.refuseMain {
  ::v-deep .el-radio-group {
    display: flex !important;
    flex-direction: column !important;
  }
  .el-radio {
    margin-bottom: 15px !important;
    margin-left: 20px !important;
  }
  .el-input--medium {
    font-size: 14px;
  }
  .el-textarea {
    width: 90%;
  }
}
.ex-diolog {
  ::v-deep .ex--dialog--footer {
    border: none !important;
  }

  .main {
    margin: 0 auto;
  }
  .pic-list {
    display: flex;
    justify-content: space-around;
    width: 660px;
  }
  .img {
    display: block;
    width: 200px;
    height: auto;
  }
}
.list {
  ::v-deep .el-form-item {
    display: flex;
    justify-content: flex-start;
  }
  ::v-deep .el-form-item__label {
    width: 120px;
  }
  ::v-deep .el-form-item__content {
    width: 300px;
  }
}
</style>
